/**
 * 统计系统类型定义
 */

export interface StatisticsData {
  totalWords: number;
  totalArticles: number;
  totalDays: number;
  consecutiveDays: number;
  avgQualityScore: number;
  aiUsageCount: number;
  templateUsageCount: number;
  inspirationCount: number;
}

export interface EfficiencyAnalysis {
  avgTimePerArticle: number;
  stageBreakdown: {
    brainstorm: number;
    outline: number;
    writing: number;
    optimization: number;
  };
  peakHours: number[];
  efficiencyTrend: Array<{
    date: string;
    efficiency: number;
  }>;
}

export interface QualityTrendData {
  date: string;
  score: number;
  breakdown: {
    structure: number;
    logic: number;
    readability: number;
    originality: number;
  };
}

export interface Achievement {
  id: string;
  name: string;
  description: string;
  icon: string;
  category: 'beginner' | 'milestone' | 'quality' | 'efficiency' | 'exploration' | 'community';
  unlocked: boolean;
  progress?: number;
  total?: number;
  unlockedAt?: string;
  rewards?: {
    xp: number;
    badge?: string;
  };
}

export interface UserLevel {
  level: number;
  currentXP: number;
  nextLevelXP: number;
  totalXP: number;
  privileges: string[];
  title?: string;
}

export interface CalendarData {
  [date: string]: {
    wordCount: number;
    articleCount: number;
    qualityScore?: number;
  };
}

export interface RankingEntry {
  userId: string;
  username: string;
  avatar?: string;
  value: number;
  rank: number;
}

export interface RankingsData {
  rankings: RankingEntry[];
  myRank: number | null;
  total: number;
}

export type TimeRange = 'today' | 'week' | 'month' | 'all';
export type RankingType = 'words' | 'quality' | 'efficiency' | 'templates';

export interface CreationGoal {
  id: string;
  type: 'daily' | 'weekly' | 'monthly';
  target: number;
  current: number;
  metric: 'articles' | 'words' | 'quality';
  startDate: string;
  endDate: string;
  completed: boolean;
}

export interface StatisticsReport {
  period: {
    start: string;
    end: string;
  };
  summary: StatisticsData;
  highlights: {
    bestArticle?: {
      id: string;
      title: string;
      score: number;
    };
    mostProductiveDay?: {
      date: string;
      wordCount: number;
    };
    growthRate?: number;
  };
  achievements: Achievement[];
  recommendations: string[];
}

export interface EventTracking {
  event: string;
  metadata?: Record<string, any>;
  timestamp: string;
  userId?: string;
}
